package com.teach.service.impl.photo;

import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.teach.entity.PhotoOrder;
import com.teach.entity.PhotoOrderDetail;
import com.teach.mapper.PhotoOrderDetailMapper;
import com.teach.mapper.PhotoOrderMapper;
import com.teach.service.photo.PhotoOrderDetailService;
import com.teach.service.photo.PhotoOrderService;

@Service
public class PhotoOrderServiceImpl implements PhotoOrderService{

	@Autowired
	private PhotoOrderMapper mapper;
	
	@Autowired
	private PhotoOrderDetailService service;
	
	@Override
	public int deleteByPrimaryKey(Long photoOrderId) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public int insert(PhotoOrder record) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public int insertSelective(PhotoOrder record) {
		record.setPhotoPlaceOrderTime(new Date());
		record.setPhotoOrderStatus("待发货");	
		return mapper.insertSelective(record);
	}

	@Override
	public PhotoOrder selectByPrimaryKey(Long photoOrderId) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public int updateByPrimaryKeySelective(PhotoOrder record) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public int updateByPrimaryKey(PhotoOrder record) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public int count(String shopId) {
		List<Long> list = service.selectWriter(shopId);
		int count1 = 0;
		for (int i = 0; i < list.size(); i++) {
			count1 += mapper.count(list.get(i));
		}
		return count1;
	}

}
